package org.tuoren.official.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.tuoren.common.core.domain.R;
import org.tuoren.common.core.validate.AddGroup;
import org.tuoren.common.core.validate.EditGroup;
import org.tuoren.common.excel.utils.ExcelUtil;
import org.tuoren.common.idempotent.annotation.RepeatSubmit;
import org.tuoren.common.log.annotation.Log;
import org.tuoren.common.log.enums.BusinessType;
import org.tuoren.common.mybatis.core.page.PageQuery;
import org.tuoren.common.mybatis.core.page.TableDataInfo;
import org.tuoren.common.web.core.BaseController;
import org.tuoren.official.domain.bo.ProductBo;
import org.tuoren.official.domain.vo.ProductVo;
import org.tuoren.official.es.domain.ProductEs;
import org.tuoren.official.es.domain.TNewsCenterES;
import org.tuoren.official.service.IProductESService;
import org.tuoren.official.service.IProductService;

import java.util.List;

/**
 * 产品信息-es搜索
 *
 * @author wl
 * @date 2024-11-26
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/es/official/product")
public class ProductESController extends BaseController {

    private final IProductESService esService;

    /**
     * 初始化ES产品信息
     */
    @SaIgnore
    @GetMapping("/initData")
    public R<Void> initData() {
        return esService.initData();
    }

    /**
     * ES搜索产品信息
     */
    @SaIgnore
    @GetMapping("/search")
    public TableDataInfo<ProductEs> searchList(String searchText, PageQuery pageQuery){
        return esService.searchList(searchText,pageQuery);
    }
}
